// banner 轮播
var n = 0;

function play() {
	if (n > 3) {
		n = 0;
	} else {
		n++;
	}
	$(".banner li").eq(n).fadeIn(0).siblings().fadeOut(0);
}
var t = setInterval("play()", 3000);
$(".banner").mouseenter(function() {
	clearInterval(t);
}).mouseleave(function() {
	var t = setInterval("play()", 3000);
})
//表单验证功能
function tagname(tagname) {
	return document.getElementsByTagName(tagname);
}

function yangzheng() {
	if (name() && phone() && company() && tencent() && need() && yz()) {
		return true;
	} else {
		return false;

	}
}
// 姓名验证
function name() {
	//验证用户名不能为空
	var myuid = $("input_id").value;
	if (myuid.length == 0) {
		$("c1").innerText = "姓名不能为空";
		return false;
	} else {
		//验证用户名不能有数字
		var myuids = myuid.split("");
		for (i = 0; i < myuids.length; i++) {
			if (!isNaN(myuid[i])) {
				$("c1").innerText = "姓名不能包含数字";
				return false;
			}
		}
	}
	if (myuid.length != 0 || (!isNaN(i))) {
		$("c1").innerText = "";
	}
	return true;
}
// 联系电话验证
function phone() {
	var pwd = tagname("input").item(1).value;
	if (pwd.length == 0) {
		tagname("span").item(1).innerText = "电话不能为空";
		return false;
	} else {
		if (pwd.length > 11) {
			tagname("span").item(1).innerText = "电话不能大于11位数";
			return false;
		}
	}
	tagname("span").item(1).innerText = "";
	return true;
}

//邮箱验证 QQ或者微信

function tencent() {
	var email = tagname("input").item(3).value;
	if (email.length == "") {
		tagname("span").item(3).innerText = "邮箱不能为空";
		return false;
	}
	if (email.lastIndexOf("@") == -1) {
		tagname("span").item(3).innerText = "邮箱中必须包含@";
		return false;
	}
	if (email.lastIndexOf(".") == -1) {
		tagname("span").item(3).innerText = "邮箱中必须包含.";
		return false;
	}
	if (email.lastIndexOf(".") - email.lastIndexOf("@") <= 1) {
		tagname("span").item(3).innerText = "邮箱格式不对";
		return false;
	}
	tagname("span").item(3).innerText = "";
	return true;
}


// 验证码验证功能
function yz() {
	var pic = tagname("input").item(5).value;
	var s = pic.lastIndexOf(".") + 1;
	var t = pic.substring(s, pic.length);
	if (t == "jpg" || t == "png" || t == "JPG" || t == "PNG") {
		tagname("span").item(5).innerText = "";
		return true;
	} else {
		tagname("span").item(5).innerText = "格式不对";
		return false;
	}
}
